package com.beamfield.dao.sys;

import com.beamfield.model.Outbound;
import com.beamfield.model.Supplies;
import com.beamfield.model.SuppliesExample;
import com.beamfield.modelVo.MaterialStraceVo;
import com.beamfield.modelVo.SteelplantRebarVO;
import com.beamfield.modelVo.SuppliesOutboundVo;
import com.beamfield.modelVo.SuppliesVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface SuppliesMapper {
	int deleteByPrimaryKey(String supplies_id);

	int insert(Supplies record);

	int insertSelective(Supplies record);

	List<Supplies> selectByExampleWithBLOBs(SuppliesExample example);

	List<Supplies> selectByExample(SuppliesExample example);

	Supplies selectByPrimaryKey(String supplies_id);

	int updateByPrimaryKeySelective(Supplies record);

	int updateByPrimaryKeyWithBLOBs(Supplies record);

	int updateByPrimaryKey(Supplies record);

	@Delete("delete from t_supplies where beam_id=#{0}")
	void deleteAll(Long beamid);

	List<Supplies> getSuppliesByBeamIdAndSuppliesType(@Param("beamId") long beamId,
													  @Param("suppliesType") String suppliesType,
													  @Param("projectId") String projectId,
													  @Param("suppliesName") String suppliesName);


	List<SuppliesVo> selectSuppliesPage(@Param("beam_id") Long beam_id, @Param("supplies_material_name") String supplies_material_name,
										@Param("supplies_name") String supplies_name, @Param("supplies_material_standard") String supplies_material_standard,
										@Param("offset") Integer offset, @Param("next") Integer next);

	int selectSuppliesCount(@Param("beam_id") Long beam_id, @Param("supplies_material_name") String supplies_material_name,
									  @Param("supplies_name") String supplies_name, @Param("supplies_material_standard") String supplies_material_standard);



	/**
	 * 查询是否有相同的材料
	 * @date 2018年6月13日
	 * @author mintonzhang@163.com
	 * @param supplies_name 材料名
	 * @param supplies_material_standard 标准
	 * @param beamid
	 * @return
	 */
	Supplies selectIsSameData(@Param("supplies_name") String supplies_name,
			@Param("supplies_material_standard") String supplies_material_standard, @Param("beamid") Long beamid);

	/**
	 * 按照类型查询材料
	 * @date 2018年6月13日
	 * @author mintonzhang@163.com
	 * @param type
	 * @param beamid
	 * @return
	 */
	List<Supplies> selectByType(@Param("codeList")List<String> codeList,@Param("beamid") Long beamid);

    List<Supplies> selectDistinctByName(@Param("beamId")long beamId,@Param("projectId")  String projectId);

	List<Supplies> selectSuppliesDistinctByNameAndMaterialName(@Param("type") String type, @Param("beamId") long beamId, @Param("projectId") String projectId);

	List<SuppliesOutboundVo> selectSuppliesByTypeWithIssueAndOutbound(@Param("type") String type, @Param("beamId") Long beamId);

	List<String> getSuppliesName(@Param("beamId") Long beamId);

	double getDemandNum(@Param("suppliesId")String suppliesId,@Param("beamId")Long beamId);

	List<Outbound> selectOutNum(@Param("projectDetailId") Long projectDetailId);

	MaterialStraceVo selectInboundInfo(@Param("inboundId") Long inboundId);

	int updateSuppliesTestItem(@Param("suppliesIdList") List<String> suppliesIdList,@Param("parameters") String parameters);

    List<Supplies> selectNotInProduct(@Param("productId") String productId,@Param("beamId") Long beamId);

    Supplies selectBySuppliesNameAndSuppliesModel(@Param("suppliesName") String suppliesName, @Param("suppliesModel") String suppliesModel, @Param("beamId") Long beamId);

    List<SteelplantRebarVO> pageSelectByType(@Param("type") String type, @Param("offset") String offset, @Param("limit") String limit, @Param("beamId") Long beamId);

    Integer selectAllByType(@Param("type") String type, @Param("beamId") Long beamId);

    String getSuppliesByName(@Param("name") String name);

	List<Supplies> selectByNameLike(@Param("beamId") Long beamId, @Param("name") String name);

    List<Supplies> selectXinCai(Long beamId);

    List<String> getRebarModel(Long beamId);
}
